<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------

namespace app\api\validate;

use app\common\validate\ValidateBase;

class MiniProgramConsult extends ValidateBase
{
    // 验证规则
    protected $rule = [
        'name' => 'require',
        'mobile' => 'require|regex:/^1[345789]\d{9}$/',
        'is_inform' => 'require|in:0,1',
        'career' => 'require|number',
        'content' => 'require',
    ];

    // 验证提示
    protected $message = [
        'name.require' => '姓名不能为空',
        'mobile.require' => '手机号不能为空',
        'mobile.regex' => '手机号不符号规则',
        'is_inform.require' => '短信通知选项不能为空',
        'is_inform.in' => '短信通知选项只能是0或者1',
        'career.require' => '感兴趣专业不能为空',
        'career.number' => '专业只能是整数',
        'content.require' => '留言内容不能为空',
    ];

    // 应用场景
    protected $scene = [
        'add' => ['name', 'mobile', 'is_inform', 'career', 'content'],
    ];
}